<% content_for :head do %>
  <%= stylesheet_link_tag 'scaffold' %>
  <%= javascript_include_tag :defaults %>
<% end %>

<h1>Listing problems</h1>

<div class="usermenu">
<%= link_to 'Main', :controller => 'main', :action => 'list' %>
</div>

<%= link_to 'New problem', :action => 'new' %><br/>

<table>
  <tr>
    <th>Name</th>
    <th>Full name</th>
    <th>Full score</th>
    <th>Date added</th>
    <th>Available</th>
  </tr>
  
<% for problem in @problems %>
  <tr>
    <% @problem=problem %>
    <td><%= in_place_editor_field :problem, :name, {}, :rows=>1 %>
    <td><%= in_place_editor_field :problem, :full_name, {}, :rows=>1 %>
    <td><%= in_place_editor_field :problem, :full_score, {}, :rows=>1 %>
    <td><%= problem.date_added %>
    <td><%= problem.available %>

    <td><%= link_to '[Toggle]', :action => 'toggle_avail', :id => problem.id %></td>
    <td><%= link_to '[Stat]', :action => 'stat', :id => problem.id %></td>
    <td><%= link_to '[Show]', :action => 'show', :id => problem %></td>
    <td><%= link_to '[Edit]', :action => 'edit', :id => problem %></td>
    <td><%= link_to '[Destroy]', { :action => 'destroy', :id => problem }, :confirm => 'Are you sure?', :method => :post %></td>
  </tr>
<% end %>
</table>


<br />

<%= link_to 'New problem', :action => 'new' %>
